import request from '@/utils/request'

/**
 * 获取权限点列表
 * @returns 获取结果
 */
export const getPrmListAPI = () => {
  return request({
    url: '/sys/permission',
    method: 'get'
  })
}

/**
 * 新增权限
 * @param {Object} permisonForm 权限表单
 * @returns 响应数据
 */
export const addPermisionAPI = (permisonForm) => {
  return request({
    url: '/sys/permission',
    data: permisonForm,
    method: 'post'
  })
}

/**
 * 获取权限详情
 * @param {String} id 权限id
 * @returns 权限详情
 */
export const getPermInfoAPI = (id) => {
  return request({
    url: `/sys/permission/${id}`,
    method: 'get'
  })
}

/**
 * 编辑权限
 * @param {Object} permForm 权限表单
 * @returns 编辑结果
 */
export const editPermiAPI = (permForm) => {
  return request({
    url: `/sys/permission/${permForm.id}`,
    data: permForm,
    method: 'put'
  })
}

/**
 * 删除权限点
 * @param {String} id 节点id
 * @returns 删除结果
 */
export const delPermisonAPI = (id) => {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}
